/*
 * File: stack_from_darray.h 
 * Author:  Yin Lijun <yinlijun2004@gmail.com>
 * Brief:   stack_from_darray header.
 *
 * Copyright (c) 2011 - 2012  Yin Lijun <yinlijun2004@gmail.com>
 *
 * Licensed under the Academic Free License version 2.1
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/*
 * History:
 * ================================================================
 * 2012-03-12 Yin Lijun <yinlijun2004@gmail.com> created
 *
 */
#ifndef STACK_FROM_DARRAY_H
#define STACK_FROM_DARRAY_H

#include "typedef.h"

#ifdef __cplusplus
extern "C" {
#endif

struct _Stack;
typedef struct _Stack Stack;

Stack* stack_create(DestoryFunc dest);
Ret stack_push_data(Stack* thiz, void* data);
void* stack_pop_data(Stack* thiz);
Ret stack_get_top_data(Stack* thiz, void** data);
size_t stack_get_length(Stack* thiz);
Ret stack_foreach(Stack* thiz, VisitFunc visit, void* ctx);
Ret stack_destroy(Stack* thiz);

#ifdef __cplusplus
}
#endif

#endif //STACK_FROM_DARRAY_H
